package com.cskaoyan.dbutils.rsh;

import com.cskaoyan.connectionpool.opensource.DruidUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.MapListHandler;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
 * 创建日期: 2022/08/29 11:28
 *
 * @author ciggar
 */
public class MapListHandlerDemo {

    public static void main(String[] args) throws SQLException {


        // 1. 获取QueryRUnner
        QueryRunner queryRunner = new QueryRunner(DruidUtils.getDataSource());

        // 2. 执行SQL语句
        List<Map<String,Object>> mapList =   queryRunner.query("select * from user",new MapListHandler());


        System.out.println(mapList);
    }

}
